package com.example.demo.alipay;

import com.alipay.api.AlipayApiException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

@RestController
public class AliPayController {
    @Autowired
    private AlipayServiceImpl alipayService;
    @RequestMapping("/imgurlbj1")
    public void getAll() throws AlipayApiException {
        alipayService.model();  //创建会员卡模板
        alipayService.chuangjian(); //会员卡开卡表单模板配置
        alipayService.fafang(); //获取投放链接
            //获取token
           //查询用户提交的会员卡表单信息
           //为用户开卡
    }
    @RequestMapping("/urlsgrz")
    public HashMap<String,String> urlsgrz(String code){
        return alipayService.urlsgrz(code);
    }
    @RequestMapping("/userInfo")
    public HashMap<String,String> userInfo(String template_id,String accessToken,String requestId) throws AlipayApiException {
        return alipayService.userInfo(template_id, accessToken, requestId);
    }
    @RequestMapping("/opencard")
    public HashMap<String,String> opencard(String template_id,String accessToken,String UserId) throws AlipayApiException {
        return alipayService.opencard(template_id, accessToken, UserId);
    }
}
